<?php


$page_title = 'Home';

include("connection.php"); 


$userName=$_POST["userName"];
$password=$_POST["password"];
if( isset($_POST['login']))
{
	
	$error = array();
    if($userName == ''){
		$error['userName'] = 'Please enter the username! ';
	}
	
	if($password == ''){
		$error['password'] = 'Please enter the password!';
	}
	
	if(count($error) > 0){
		$_SESSION["error"] = $error;
		header("location: login.php");
		EXIT;
	}
	else{
		$check=mysql_query("Select MemberID,MemberName from Member where Email='".$userName."' and Password ='".$password."' ");
		
		if(mysql_num_rows($check)==0){
		
			echo "Wrong User Name & Password!";

		}else{
			$myrow=mysql_fetch_array($check);
			
			$_SESSION['MemberID']=$myrow['MemberID'];
			$_SESSION['MemberName']=$myrow['MemberName'];
			
			header("location: Home.php");
			exit;
		}
	}
}



?>



